﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Collections.Generic;

namespace WebserviceLab2
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public List<Product> getAllProduct()
        {
            return Product.getAll();
        }

        [WebMethod]
        public Product[] getAllByType(String type)
        {
            string url = Utilies.Helpers.GetURLContext(this.Context);
            return Product.getAllByType(type, url);
        }

        [WebMethod]
        public String[] getProductTypes()
        {
            return Product.getType();
        }

        [WebMethod]
        public int sum(int fnums, int snums){
            return fnums + snums;
        }

        [WebMethod]
        public string sumAndSub(int fnums, int snums, int tnums){
            return (fnums + snums - tnums).ToString();
        }

    }
}
